package com.zuxia.service.impl;

import java.util.List;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.zuxia.dao.impl.MessageDao;
import com.zuxia.entity.Admin;
import com.zuxia.entity.Message;
import com.zuxia.service.IMessageService;

@Service("messageService")
public class MessageService implements IMessageService {
	@Resource(name="messageDao")
	private MessageDao messageDao;

	public List<Message> selectAll() {
		return messageDao.selectAll();
	}
	
	public Message selectId(int id) {
		return messageDao.selectId(id);
	}
	
	/**
	 * 删除
	 */
	public boolean deleteMessage(Message message) {
		int i = messageDao.deleteMessage(message);
		if(i>0) {
			return true;
		}
		return false;
	}
	/**
	 * 批量删除
	 */
	public boolean batchDelteMessage(String checks) {
		try {
			messageDao.batchDelteMessage(checks);
		} catch (Exception e) {
			return false;
		}
		return true;
	}
	public boolean saveMessage(Message message) {
		int i = messageDao.saveMessage(message);
		if(i>0) {
			return true;
		}
		return false;
	}

	public List<Message> selectTime() {
		return messageDao.selectTime();
	}

	public String updateMessage(Message message) {
		try {
			messageDao.updateMessage(message);
			return "updateMessage";
		} catch (Exception e) {
			System.out.println("修改失败！！");
			return "error";
		}
	}
}
